

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class hamming
{

	private static final String OUTPUT_FILE = "hamming.out";
	private static final String INPUT_FILE = "hamming.in";
	static int N, B, D;
	static int range;
	static int dist[][],ans[];
	static Scanner in;
	static PrintWriter out;
	static boolean flag=true;
	
	static void predo()
	{
		range=1<<B;
		dist=new int[range][range];
		ans=new int[range];
		for (int i=0; i<range; i++)
			for (int j=0; j<range; j++)
			{
				dist[i][j]=0;
				for (int x=i^j; x>0; x-=x&-x)
				{
					dist[i][j]++;
				}
			}
	}
	
	static void search(int k, int start)
	{
		if (k==N)
		{
			output();
			flag=false;
			return ;
		}
		for ( ; flag&& start <range; start++)
		{
			boolean ok=true;
			for(int i=0; i<k; i++)
				if(dist[ans[i]][start] <D)
				{
					ok=false;
					break;
				}
			if (ok)
			{
				ans[k]=start;
				search(k+1,start+1);
			}
		}
	}

	private static void output()
	{
		for(int i=0; i<N; i++)
		{
			if (i % 10 >0) 
				out.print(" ");
			out.print(ans[i]);
			if (i%10==9 || i==N-1)
				out.print("\n");

		}
	}
	
	public static void main(String[] args) throws IOException
	{
		in=new Scanner(new FileReader(INPUT_FILE));
		out=new PrintWriter(new FileWriter(OUTPUT_FILE));

		input();
		predo();
		search(0,0);
		out.flush();
	}

	private static void input()
	{
		N=in.nextInt();
		B=in.nextInt();
		D=in.nextInt();
	}

}
